Optimal. Leaf size=80 \[ \frac {1}{2} \left (a^2 A+2 A b^2+4 a b B\right ) x+\frac {b^2 B \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a (2 A b+a B) \sin (c+d x)}{d}+\frac {a^2 A \cos (c+d x) \sin (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {4109, 4132, 8,
4130, 3855} \begin {gather*} \frac {1}{2} x \left (a^2 A+4 a b B+2 A b^2\right )+\frac {a^2 A \sin (c+d x) \cos (c+d x)}{2 d}+\frac {a (a B+2 A b) \sin (c+d x)}{d}+\frac {b^2 B \tanh ^{-1}(\sin (c+d x))}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3855
Rule 4109
Rule 4130
Rule 4132
Rubi steps
\begin {align*} \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx &=\frac {a^2 A \cos (c+d x) \sin (c+d x)}{2 d}-\frac {1}{2} \int \cos (c+d x) \left (-2 a (2 A b+a B)+\left (A \left (-a^2-2 b^2\right )-4 a b B\right ) \sec (c+d x)-2 b^2 B \sec ^2(c+d x)\right ) \, dx\\ &=\frac {a^2 A \cos (c+d x) \sin (c+d x)}{2 d}-\frac {1}{2} \int \cos (c+d x) \left (-2 a (2 A b+a B)-2 b^2 B \sec ^2(c+d x)\right ) \, dx-\frac {1}{2} \left (-a^2 A-2 A b^2-4 a b B\right ) \int 1 \, dx\\ &=\frac {1}{2} \left (a^2 A+2 A b^2+4 a b B\right ) x+\frac {a (2 A b+a B) \sin (c+d x)}{d}+\frac {a^2 A \cos (c+d x) \sin (c+d x)}{2 d}+\left (b^2 B\right ) \int \sec (c+d x) \, dx\\ &=\frac {1}{2} \left (a^2 A+2 A b^2+4 a b B\right ) x+\frac {b^2 B \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a (2 A b+a B) \sin (c+d x)}{d}+\frac {a^2 A \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.23, size = 120, normalized size = 1.50 \begin {gather*} \frac {2 \left (a^2 A+2 A b^2+4 a b B\right ) (c+d x)-4 b^2 B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+4 b^2 B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+4 a (2 A b+a B) \sin (c+d x)+a^2 A \sin (2 (c+d x))}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.23, size = 94, normalized size = 1.18
method | result | size |
derivativedivides | \(\frac {a^{2} A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a^{2} B \sin \left (d x +c \right )+2 A b a \sin \left (d x +c \right )+2 B a b \left (d x +c \right )+A \,b^{2} \left (d x +c \right )+b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) | \(94\) |
default | \(\frac {a^{2} A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a^{2} B \sin \left (d x +c \right )+2 A b a \sin \left (d x +c \right )+2 B a b \left (d x +c \right )+A \,b^{2} \left (d x +c \right )+b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) | \(94\) |
risch | \(\frac {a^{2} A x}{2}+x A \,b^{2}+2 x B a b -\frac {i {\mathrm e}^{i \left (d x +c \right )} A b a}{d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} a^{2} B}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} A b a}{d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a^{2} B}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2} B}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2} B}{d}+\frac {a^{2} A \sin \left (2 d x +2 c \right )}{4 d}\) | \(156\) |
norman | \(\frac {\left (\frac {1}{2} a^{2} A +A \,b^{2}+2 B a b \right ) x +\left (\frac {1}{2} a^{2} A +A \,b^{2}+2 B a b \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-a^{2} A -2 A \,b^{2}-4 B a b \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {a \left (A a +4 A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a \left (3 A a -4 A b -2 B a \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a \left (A a -4 A b -2 B a \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a \left (3 A a +4 A b +2 B a \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\frac {b^{2} B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b^{2} B \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) | \(269\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 99, normalized size = 1.24 \begin {gather*} \frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{2} + 8 \, {\left (d x + c\right )} B a b + 4 \, {\left (d x + c\right )} A b^{2} + 2 \, B b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{2} \sin \left (d x + c\right ) + 8 \, A a b \sin \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.41, size = 87, normalized size = 1.09 \begin {gather*} \frac {B b^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - B b^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + {\left (A a^{2} + 4 \, B a b + 2 \, A b^{2}\right )} d x + {\left (A a^{2} \cos \left (d x + c\right ) + 2 \, B a^{2} + 4 \, A a b\right )} \sin \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2} \cos ^{2}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 178 vs.
\(2 (76) = 152\).
time = 0.52, size = 178, normalized size = 2.22 \begin {gather*} \frac {2 \, B b^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 2 \, B b^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + {\left (A a^{2} + 4 \, B a b + 2 \, A b^{2}\right )} {\left (d x + c\right )} - \frac {2 \, {\left (A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.38, size = 169, normalized size = 2.11 \begin {gather*} \frac {B\,a^2\,\sin \left (c+d\,x\right )}{d}+\frac {A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,A\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {A\,a^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {2\,A\,a\,b\,\sin \left (c+d\,x\right )}{d}+\frac {4\,B\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________